<template>
  <div>
    <navs></navs>
    <div class="list_bx">
      <div class="list_top">
        <a href="">首页</a> > <span>22SS男士新品</span>
      </div>
      <div class="list_body">
        <!-- 遍历 -->
        <div class="list_list" v-for="(item, index) in list" :key="index">
          <div class="list_new">
            <span>{{ item.top }}</span>
          </div>
          <div class="list_picture">
            <router-link to="/details"
              ><img :src="item.img" alt="" class="list_xie"
            /></router-link>
          </div>
          <p class="list_xi">{{ item.logo }}</p>
          <p class="list_price">
            <span>￥{{ item.price }}</span>
            <span class="list_wu">￥{{ item.price2 }}</span>
          </p>
          <div class="list_text">
            <p class="list_text2">{{ item.text }}</p>
            <div class="list_min_img">
              <div
                class="list_none"
                v-for="(item, index_minImg) in item.min_img"
                :key="index_minImg"
                @mouseenter="handleMouseenter(index, index_minImg)"
              >
                <router-link to="/details"
                  ><img :src="item" alt="" class="list_xie2"
                /></router-link>
              </div>
            </div>
          </div>
          <!-- 快速浏览 -->
          <div class="listsss_bottom">
            <button>
              <router-link to="/list/quicktour">{{ item.text2 }}</router-link>
            </button>
          </div>
        </div>
      </div>
    </div>
    <router-view></router-view>
    <returnTop></returnTop>
    <footers></footers>
  </div>
</template>

<script setup>
// 引入组件
import returnTop from "../components/ReturnTop.vue";
import navs from "../components/Nav.vue";
import footers from "../components/Footer.vue";
import { ref, reactive } from "vue";
const list = reactive([
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 1989,
    price2: 2599,
    text: "二种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg",
      "/public/images/list-search-cart/xie2.jpg",
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "二种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg",
      "/public/images/list-search-cart/xie2.jpg",
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
  {
    top: "NEW",
    img: "/public/images/list-search-cart/xie.jpg",
    logo: "AIBU男子高尔夫S3系列",
    price: 2989,
    price2: 2599,
    text: "一种颜色",
    text2: "快速浏览",
    min_img: [
      "/public/images/list-search-cart/xie.jpg"
    ],
  },
]);
// 鼠标移入显示当前图片路径
function handleMouseenter(index, index_minImg) {
  console.log(index_minImg);
  list[index].img = list[index].min_img[index_minImg];
}
</script>

<style lang="less" scoped>
* {
  margin: 0;
  padding: 0;
}

@media screen and (min-width: 771px) {
  .list_bx {
    width: 80%;
    margin: 6rem auto;
    .list_top {
      padding: 5px 0;
      a {
        text-decoration: none;
        color: black;
      }
      a:hover {
        color: #ccc;
      }
    }
    .list_body {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      .list_list {
        width: 17%;
        padding: 30px 20px 20px;
        margin: 20px 0;
        background-color: white;
        transition: all 0.3s ease-in-out;
        .list_new {
          position: relative;
          span {
            font-size: 20px;
            position: absolute;
          }
          &:before {
            content: "";
            width: 50px;
            height: 50px;
            left: -18px;
            top: -5px;
          }
          &:before {
            background: #e9e4ea;
            position: absolute;
            z-index: 0;
          }
        }
        .list_picture {
          a {
            .list_xie {
              width: 100%;
            }
          }
        }
        .list_xi {
          text-align: center;
          font-size: 16px;
          margin-bottom: 8px;
        }
        .list_price {
          text-align: center;
          font-size: 15px;
          color: #000;
          .list_wu {
            text-decoration: line-through;
            color: #999;
          }
        }
        .list_text {
          text-align: center;
          padding-top: 10px;
          font-size: 12px;
          color: #616265;
          .list_text2 {
            transition: all 0.5s ease-in-out;
          }
          .list_min_img {
            display: flex;
            justify-content: center;
            .list_none {
              height: 20px;
              opacity: 0;
              transition: all 0.5s ease-in-out;
              a {
                .list_xie2 {
                  position: relative;
                  width: 20px;
                }
              }
            }
          }
        }
        .listsss_bottom {
          text-align: center;
          margin-top: 22px;
          button {
            cursor: pointer;
            height: 44px;
            border: 2px solid #616265;
            line-height: 40px;
            padding: 0;
            font-size: 16px;
            color: #616265;
            padding: 0 42px;
            border-radius: 0;
            transform: scale(1);
            transition-duration: 0.3s;
            transition-timing-function: ease-out;
            opacity: 0;
          }
          button:hover {
            background-color: #000;
            transform: scale(1);
            transition-duration: 0.3s;
            transition-timing-function: ease-out;
          }
          button:hover a {
            color: white;
          }
        }
      }
      .list_list:hover {
        z-index: 5;
        box-shadow: 0px 5px 39px #ccc;
      }
      .list_list:hover .list_text2 {
        opacity: 0;
      }
      .list_list:hover .list_min_img > .list_none {
        opacity: 1;
      }
      .list_list:hover .listsss_bottom > button {
        opacity: 1;
      }
    }
  }
}
// @media screen and (max-width: 770px) {
//   .bx {
//     display: none;
//   }
// }
</style>
